package com.sky.orangehireserver.modules.admin.controller;

import com.sky.orangehireserver.aspect.ApiOperationLog;
import com.sky.orangehireserver.modules.admin.dto.AdminLoginDTO;
import com.sky.orangehireserver.modules.admin.service.AdminAuthService;
import com.sky.orangehireserver.modules.admin.vo.AdminLoginVO;
import com.sky.orangehireserver.utils.Response;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/admin/auth")
@RequiredArgsConstructor
@Tag(name = "超级管理员端-登录认证管理", description = "超级管理员端-登录认证相关接口")
public class AdminAuthController {
    private final AdminAuthService adminAuthService;


    /**
     * @description HR-SAAS-超级管理员登录
     * @param loginDTO 登录请求DTO
     * @return 登录响应VO
     */
    @PostMapping("/login")
    @Operation(summary = "HR-SAAS-超级管理员登录", description = "HR-SAAS-超级管理员登录")
    @ApiOperationLog(description = "HR-SAAS-超级管理员登录")
    public Response<AdminLoginVO> login(@Valid @RequestBody AdminLoginDTO loginDTO) {
        AdminLoginVO loginVO = adminAuthService.login(loginDTO);
        return Response.success(loginVO);
    }
}
